package model.general;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import javax.imageio.ImageIO;

public class LoadImage {
	private static String IMAGE_DIR = "image/";

	public LoadImage() {
	}

	public BufferedImage getbufferImage(String fnm) {
		File f = null;
		URL path = this.getClass().getResource(IMAGE_DIR + fnm);
		try {

			URI uri = path.toURI();
			f = new File(uri);
		} catch (URISyntaxException e1) {
			e1.printStackTrace();
		}

		try {
			BufferedImage im = ImageIO.read(f);
			return im;
		} catch (IOException e) {
			System.out.println("Load Image error for " + IMAGE_DIR + "/" + fnm
					+ ":\n" + e);
			return null;
		}
	}

}
